package com.oyjd.soft;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;

import com.oyjd.FileOP;

public class Bu {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String sql = "select apk_path from T_TEMP_APK_DOWN where link_flag=1";
		Connection conn = null;
		Map<String, String> map = new HashMap<String, String>();
		try {
			conn = Conn.getConn();
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(sql);
			while (rs.next()) {
				String apk = rs.getString("apk_path");
				String a = FileOP.getNewHashName(apk, "sl_apk");
				String b = FileOP.getNewHashName(NetDeal.soft_url + apk + ".apk", "sl_apk");
				map.put(a, b);
			}
			rs.close();
			stmt.close();
			conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (conn != null)
					conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		System.out.println("-------->"+map.size());
		
		for(String key:map.keySet()){
			String v=map.get(key);
			String sql1="update T_SOFT set sou_path='"+v+"' where sou_path='"+key+"'";
			try {
				Conn.executeSql(sql1);
			} catch (Exception e) {				
				e.printStackTrace();
			}
		}
		//

	}
}
